package com.heking.widgetlib;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.TextView;

import com.zhoug.widget.bottomnavigation.BottomNavigationGroup;

public class BottomNavigationActivity extends AppCompatActivity {
    private static final String TAG = ">>>BottomNavigationActivit";
    private TextView mTvPage;
    private BottomNavigationGroup mBottomNavigationGroup;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bottom_navigation);
        findViews();


        mTvPage.setText("page_0");

        mBottomNavigationGroup.setSelected(0);
        mBottomNavigationGroup.setOnSelectedListener((oldSelected, newSelected) -> {
            if(oldSelected==newSelected){
                mTvPage.setText("page_"+newSelected+"_选中状态再被点击");
            }else{
                mTvPage.setText("page_"+newSelected);
            }
        });

    }

    private void findViews() {
        mTvPage = findViewById(R.id.tv_page);
        mBottomNavigationGroup = findViewById(R.id.bottomNavigationGroup);
    }
}